package com.xinshujia.wxxcx.mapper;

import com.xinshujia.wxxcx.pojos.entity.Device;
import com.xinshujia.wxxcx.pojos.info.DeviceInfo;
import com.xinshujia.wxxcx.pojos.info.FunctionResultInFo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @Author Cui Han
 * @Date 2024/5/18 17:38
 * @Description: TODO
 * @Version 1.0
 */
@Mapper
public interface DeviceMapper  {

    @Select("select device,standard,minimum,percentage,`status`,operation from device ")
    List<DeviceInfo> selectDevice();


    @Select("SELECT * from device")
    List<Device> findDevieve();

    @Update("update device set standard = #{standard},minimum = #{minimum} ,percentage = #{percentage}, operation = #{operation} where id=#{id}")
    void updateDevice(Double standard, Double minimum, Integer id,Double percentage,Double operation);

    @Update("update device set `status` = 0 where device = #{device}")
    void updateStatus(String device);

    @Update("update device set `status` = 1 where device = #{device}")
    void updateStatu(String device);

    @Select("SELECT minimum from device where device=#{guid} ")
    FunctionResultInFo selectMinimum(String guid);
}
